<?php

use app\modules\cn\models\RankingAll;
use app\modules\cn\models\ExerciseList;
use app\modules\cn\models\ExerciseListDetail;

$model = new ExerciseList();

$userId = Yii::$app->session->get('userId');
?>

<link rel="stylesheet" href="/cn/css/exerciseNew/index.css?v=1.1">
<link rel="stylesheet" href="https://file.viplgw.cn/ui/thinku-ielts-new/css/exercise/index.css">
<script src="https://file.viplgw.cn/ui/public/lib/vue/vue.js"></script>
<div class="banner">
    <a href="javascript:" style="cursor: auto"></a>
</div>
<div class="container">
    <div class="exerciseNotice">
        <p><img src="https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/logo@2x.png">
            <br></p>
        <p>
            练习建议：题库已按照考试科目，划分为难度题库、考点题库、话题题库、学科题库。建议前期阅读和听力按考点和话题高效刷题，查看解析和题目讨论；口语和写作按话题和题型高效刷题，查看范文模板和题目讨论。做完题请积极分析错题，找到薄弱知识点，再针对性进行查漏补缺。建议中期做单科的整套练习，提前适应单项的做题速度；雅思讲堂有对应的视频解析。</p>
    </div>
    <div class="navList">
        <ul class="firstNav">
            <li class="<?php echo $type == 1 ? 'on' : '' ?>" data-type="1">
                <a onclick="_czc.push(['_trackEvent','做题练习','听力练习','',''])" href="/cn/exercise/listen?category=all">
                    <img src="<?php echo $type == 1 ? 'https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/listeningOn.png' : 'https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/listening.png' ?> ">
                    听力练习
                </a></li>
            <li class="<?php echo $type == 4 ? 'on' : '' ?>" data-type="4">
                <a onclick="_czc.push(['_trackEvent','做题练习','口语练习','',''])" href="/cn/exercise/speak?category=all">
                    <img
                            src="<?php echo $type == 4 ? 'https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/speakingOn.png' : 'https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/speaking@2x.png' ?>">口语练习</a>
            </li>
            <li class="<?php echo $type == 2 ? 'on' : '' ?>" data-type="2">
                <a onclick="_czc.push(['_trackEvent','做题练习','阅读练习','',''])" href="/cn/exercise/read?category=all">
                    <img src="<?php echo $type == 2 ? 'https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/readingOn.png' : 'https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/reading@2x.png' ?> ">阅读练习</a>
            </li>
            <li class="<?php echo $type == 3 ? 'on' : '' ?>" data-type="3">
                <a onclick="_czc.push(['_trackEvent','做题练习','写作练习','',''])" href="/cn/exercise/write?category=all">
                    <img src="<?php echo $type == 3 ? 'https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/writingOn.png' : 'https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/writing@2x.png' ?>">写作练习</a>
            </li>
        </ul>
        <ul class="secondNav">
            <!--      一级分类          -->

            <?php if ($type == 1) { ?>
                <li class="<?php echo $category == 'all' ? 'on' : '' ?>" data-cate="all"><a
                            onclick="_czc.push(['_trackEvent','做题练习','听力练习','全部剑雅',''])"
                            href="/cn/exercise/listen?category=all">全部剑雅</a></li>
                <li class="<?php echo $category == 'type' ? 'on' : '' ?>" data-cate="type"><a
                            onclick="_czc.push(['_trackEvent','做题练习','听力练习','按题型练',''])"
                            href="/cn/exercise/listen?category=type">按题型练</a>
                </li>
                <li class="<?php echo $category == 'topic' ? 'on' : '' ?>" data-cate="topic"><a
                            onclick="_czc.push(['_trackEvent','做题练习','听力练习','按话题练',''])"
                            href="/cn/exercise/listen?category=topic">按话题练</a>
                </li>
                <li class="<?php echo $category == 'level' ? 'on' : '' ?>" data-cate="level"><a
                            onclick="_czc.push(['_trackEvent','做题练习','听力练习','按难度练',''])"
                            href="/cn/exercise/listen?category=level">按难度练</a>
                </li>


            <?php } elseif ($type == 4) { ?>
                <li class="on" data-cate="all"><a onclick="_czc.push(['_trackEvent','做题练习','口语练习','全部剑雅',''])"
                                                  href="/cn/exercise/speak?category=all">全部剑雅</a></li>
            <?php } elseif ($type == 2) { ?>
                <li class="<?php echo $category == 'all' ? 'on' : '' ?>" data-cate="all"><a
                            onclick="_czc.push(['_trackEvent','做题练习','阅读练习','全部剑雅',''])"
                            href="/cn/exercise/read?category=all">全部剑雅</a></li>
                <li class="<?php echo $category == 'type' ? 'on' : '' ?>" data-cate="type"><a
                            onclick="_czc.push(['_trackEvent','做题练习','阅读练习','按题型练',''])"
                            href="/cn/exercise/read?category=type">按题型练</a></li>
                <li class="<?php echo $category == 'topic' ? 'on' : '' ?>" data-cate="topic"><a
                            onclick="_czc.push(['_trackEvent','做题练习','阅读练习','按话题练',''])"
                            href="/cn/exercise/read?category=topic">按话题练</a>
                </li>
                <li class="<?php echo $category == 'level' ? 'on' : '' ?>" data-cate="level"><a
                            onclick="_czc.push(['_trackEvent','做题练习','阅读练习','按难度练',''])"
                            href="/cn/exercise/read?category=level">按难度练</a>
                </li>
            <?php } elseif ($type == 3) { ?>
                <li class="<?php echo $category == 'all' ? 'on' : '' ?>" data-cate="all"><a
                            onclick="_czc.push(['_trackEvent','做题练习','写作练习','全部剑雅',''])"
                            href="/cn/exercise/write?category=all">全部剑雅</a></li>
                <li class="<?php echo $category == 'type' ? 'on' : '' ?>" data-cate="type"><a
                            onclick="_czc.push(['_trackEvent','做题练习','写作练习','按题型练',''])"
                            href="/cn/exercise/write?category=type">按题型练</a>
                </li>
            <?php } ?>
        </ul>
        <ul class="thirdNav">
            <!--      二级分类          -->
            <?php if ($type == 1) { ?>
                <?php if (!empty($datelist)): ?>
                    <?php if ($category == 'all'): ?>
                        <?php foreach ($datelist as $key => $value): if ($cate_id == $value['cate_id']) {
                            $cate_name = $value['name'];
                        } ?>
                            <li class="<?php echo $cate_id == $value['cate_id'] ? 'on' : '' ?>"
                                data-cateId="<?php echo $value['cate_id'] ?>"><a
                                        href="/cn/exercise/listen?category=<?php echo $category ?>&cate_id=<?php echo $value['cate_id'] ?>"><?php echo $value['name'] ?></a>
                            </li>
                        <?php endforeach ?>
                    <?php else: ?>
                        <?php foreach ($datelist as $key => $value): if ($cate_id == $value['cate_id']) {
                            $cate_name = $value['name'];
                        } ?>
                            <li class="<?php echo $category_id == $value['id'] ? 'on' : '' ?>"
                                data-cateId="<?php echo $value['cate_id'] ?>"><a
                                        href="/cn/exercise/listen?category=<?php echo $category ?>&category_id=<?php echo $value['id'] ?>"><?php echo $value['name'] ?></a>
                            </li>
                        <?php endforeach ?>
                    <?php endif ?>

                <?php endif ?>

            <?php } elseif ($type == 4) { ?>
                <?php if ($datelist): ?>
                    <?php foreach ($datelist as $key => $value): if ($cate_id == $value['cate_id']) {
                        $cate_name = $value['name'];
                    } ?>
                        <li class="<?php echo $cate_id == $value['cate_id'] ? 'on' : '' ?>"   data-cateId="<?php echo $value['cate_id'] ?>">
                        <a
                                href="/cn/exercise/speak?category=all&cate_id=<?php echo $value['cate_id'] ?>"><?php echo $value['name'] ?></a>
                    <?php endforeach ?>
                <?php endif ?>
            <?php } elseif ($type == 2) { ?>
                <?php if ($category == 'all'): ?>
                    <?php foreach ($datelist as $key => $value): if ($cate_id == $value['cate_id']) {
                        $cate_name = $value['name'];
                    } ?>
                        <li class="<?php echo $cate_id == $value['cate_id'] ? 'on' : '' ?>"
                            data-cateId="<?php echo $value['cate_id'] ?>"><a
                                    href="/cn/exercise/read?category=<?php echo $category ?>&cate_id=<?php echo $value['cate_id'] ?>"><?php echo $value['name'] ?></a>
                        </li>
                    <?php endforeach ?>
                <?php else: ?>
                    <?php foreach ($datelist as $key => $value): if ($cate_id == $value['cate_id']) {
                        $cate_name = $value['name'];
                    } ?>
                        <li class="<?php echo $category_id == $value['id'] ? 'on' : '' ?>"
                            data-cateId="<?php echo $value['cate_id'] ?>"><a
                                    href="/cn/exercise/read?category=<?php echo $category ?>&category_id=<?php echo $value['id'] ?>"><?php echo $value['name'] ?></a>
                        </li>
                    <?php endforeach ?>
                <?php endif ?>

            <?php } elseif ($type == 3) { ?>

                <?php if ($category == 'all'): ?>

                    <?php if (!empty($datelist[0])): ?>
                        <?php foreach ($datelist[0] as $key => $value): if ($cate_id == $value['cate_id']) {
                            $cate_name = $value['name'];
                        } ?>
                            <li class="<?php echo $cate_id == $value['cate_id'] ? 'on' : '' ?>"
                                data-cateId="<?php echo $value['cate_id'] ?>"><a
                                        href="/cn/exercise/write?category=all&cate_id=<?php echo $value['cate_id'] ?>"> <?php echo $value['name'] ?></a>
                            </li>
                        <?php endforeach ?>
                    <?php endif ?>
                <?php else: ?>
                    <?php if (!empty($datelist[1])): ?>
                        <?php foreach ($datelist[1] as $key => $value): if ($cate_id == $value['cate_id']) {
                            $cate_name = $value['name'];
                        } ?>
                            <li class="<?php echo $cate_id == $value['cate_id'] ? 'on' : '' ?>"
                                data-cateId="<?php echo $value['cate_id'] ?>"><a
                                        href="/cn/exercise/write?category=type&cate_id=<?php echo $value['cate_id'] ?>"> <?php echo $value['name'] ?> </a>
                            </li>
                        <?php endforeach ?>
                    <?php endif ?>

                <?php endif ?>


            <?php } ?>

        </ul>
    </div>


    <div class="exerciseMain">

        <?php if ($list): ?>
            <?php if ($category == 'all') { ?> <!-- 全部剑雅真题 -->
                <?php foreach ($list as $key => $value) { ?>
                    <p class="exerciseTitle"><?php echo $key ?></p>


                    <ul class="questionList">

                        <?php foreach ($value as $k => $v) { ?>
                            <?php
                            $vid = $v['content_id'];
                            // $sessionid = 'pid'.$vid;
                            // $resultid = Yii::$app->session->get($sessionid);
                            // if(!$resultid){
                            $resultid = RankingAll::find('resultid')->where(['userid' => $userId, 'typeid' => $type, 'pid' => $vid])->andWhere(['not', ['testid' => null]])->orderBy('id desc')->distinct()->asArray()->One();
                            $resultid = $resultid['resultid'];
                            // }
                            // f_d($resultid);
                            // 查询重复名词做题次数 根据题号累加
                            $name          = $v['name'];
                            $vount         = 0; // 练习人数
                            $dal           = $model->getlistenexercisedotest($vid);
                            $allnumber     = 0; // 所有做题数
                            $allnum        = 0; // 所有题数
                            $alltruenumber = 0; // 所有正确题数
                            // $num = 0;
                            foreach ($dal as $vcc) {
                                $vount = $vount + $vcc['viewCount'];
                                $id    = $vcc['content_id'];
                                // 总数
                                $num    = count(ExerciseListDetail::find()->where(['pid' => $id])->asArray()->All());
                                $allnum = $allnum + $num;
                                // 做题数
                                $number = count(RankingAll::find()->where(['userid' => $userId, 'typeid' => $type, 'pid' => $id, 'resultid' => $resultid])->andWhere(['not', ['testid' => null]])->andWhere(['not', ['answer' => '']])->asArray()->All());
                                // var_dump($number);
                                $allnumber = $allnumber + $number;
                                // 正确
                                $truenumber    = count(RankingAll::find()->where(['userid' => $userId, 'result' => 1, 'typeid' => $type, 'pid' => $id])->andWhere(['not', ['testid' => null]])->asArray()->All());
                                $alltruenumber = $alltruenumber + $truenumber;
                            }
                            ?>
                            <li>
                                <img src="https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/icon@2x.png"
                                     class="exerciseIco">
                                <span class="questionStatus <?php echo $allnumber <= 0 ? 'notDone' : ($allnumber == $allnum ? 'finish' : 'breakOff') ?>"> <?php echo $allnumber <= 0 ? '未做' : ($allnumber == $allnum ? '已完成' : '中断') ?></span>
                                <p class="questionType"><?php echo $key ?></p>
                                <p class="questionName"><?php echo $typename ?><?php echo $v['name'] ?></p>
                                <p class="questionNum">
                                    <span><?php echo $key ?></span>
                                    <span><?php echo $v['viewCount'] ?>人已做</span>
                                </p>
                                <div class="hoveButton">


                                    <!-- <a href="/cn/exercise/listen-detail?content_id=<?php echo $v['content_id'] ?>" style="margin-bottom: 15px"><?php echo $allnumber <= 0 ? '开始做题' : ($allnumber == $number ? '学习/回顾' : '继续做题') ?></a> -->

                                    <?php if ($type == 1) { ?>
                                        <?php if ($userId) { ?>
                                            <?php if ($allnumber <= 0) { ?>
                                                <a onclick="_czc.push(['_trackEvent','做题练习-<?php echo $cate_seo_name; ?>-<?php echo $v['catName'] ?>','开始做题','<?php echo $v['name'] ?>',''])"
                                                   href="/cn/exercise/listen-detail?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">开始做题</a>
                                            <?php } elseif ($allnumber == $allnum) { ?>
                                                <!-- <a href="/cn/exercise/listen-detail?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">重新做题</a> -->
                                                <a href="/cn/exercise/listen-review?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">学习/回顾</a>

                                            <?php } else { ?>

                                                <a href="/cn/exercise/listen-detail?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">继续做题</a>
                                                <a href="/cn/exercise/listen-review?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">学习/回顾</a>
                                            <?php } ?>


                                        <?php } else { ?>
                                            <a onclick="_czc.push(['_trackEvent','做题练习-<?php echo $cate_seo_name; ?>-<?php echo $v['catName'] ?>','开始做题','<?php echo $v['name'] ?>',''])"
                                               href="/cn/exercise/listen-detail?content_id=<?php echo $v['content_id'] ?>"
                                               style="margin-bottom: 15px">开始做题</a>

                                        <?php } ?>

                                    <?php } elseif ($type == 4) { ?>
                                        <?php if ($userId) { ?>
                                            <?php if ($allnumber <= 0) { ?>
                                                <a onclick="_czc.push(['_trackEvent','做题练习-<?php echo $cate_seo_name; ?>-<?php echo $v['catName'] ?>','开始做题','<?php echo $v['name'] ?>',''])"
                                                   href="/cn/exercise/speak-detail?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">开始做题</a>

                                            <?php } elseif ($allnumber == $allnum) { ?>
                                                <!-- <a href="/cn/exercise/speak-detail?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">重新做题</a> -->
                                                <a href="/cn/exercise/speak-review?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">学习/回顾</a>

                                            <?php } else { ?>

                                                <a href="/cn/exercise/speak-detail?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">继续做题</a>
                                                <a href="/cn/exercise/speak-review?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">学习/回顾</a>
                                            <?php } ?>

                                        <?php } else { ?>
                                            <a onclick="_czc.push(['_trackEvent','做题练习-<?php echo $cate_seo_name; ?>-<?php echo $v['catName'] ?>','开始做题','<?php echo $v['name'] ?>',''])"
                                               href="/cn/exercise/speak-detail?content_id=<?php echo $v['content_id'] ?>"
                                               style="margin-bottom: 15px">开始做题</a>

                                        <?php } ?>

                                    <?php } elseif ($type == 2) { ?>
                                        <?php if ($userId) { ?>
                                            <?php if ($allnumber <= 0) { ?>
                                                <a onclick="_czc.push(['_trackEvent','做题练习-<?php echo $cate_seo_name; ?>-<?php echo $v['catName'] ?>','开始做题','<?php echo $v['name'] ?>',''])"
                                                   href="/cn/exercise/read-detail?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">开始做题</a>

                                            <?php } elseif ($allnumber == $allnum) { ?>
                                                <!-- <a href="/cn/exercise/read-detail?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">重新做题</a> -->
                                                <a href="/cn/exercise/read-review?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">学习/回顾</a>

                                            <?php } else { ?>

                                                <a href="/cn/exercise/read-detail?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">继续做题</a>
                                                <a href="/cn/exercise/read-review?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">学习/回顾</a>
                                            <?php } ?>

                                        <?php } else { ?>
                                            <a onclick="_czc.push(['_trackEvent','做题练习-<?php echo $cate_seo_name; ?>-<?php echo $v['catName'] ?>','开始做题','<?php echo $v['name'] ?>',''])"
                                               href="/cn/exercise/read-detail?content_id=<?php echo $v['content_id'] ?>"
                                               style="margin-bottom: 15px">开始做题</a>

                                        <?php } ?>
                                    <?php } elseif ($type == 3) { ?>
                                        <?php if ($userId) { ?>
                                            <?php if ($allnumber <= 0) { ?>
                                                <a onclick="_czc.push(['_trackEvent','做题练习-<?php echo $cate_seo_name; ?>-<?php echo $v['catName'] ?>','开始做题','<?php echo $v['name'] ?>',''])"
                                                   href="/cn/exercise/write-detail?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">开始做题</a>

                                            <?php } elseif ($allnumber == $allnum) { ?>
                                                <!-- <a href="/cn/exercise/write-detail?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">重新做题</a> -->
                                                <a href="/cn/exercise/write-review?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">学习/回顾</a>

                                            <?php } else { ?>

                                                <a href="/cn/exercise/write-detail?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">继续做题</a>
                                                <a href="/cn/exercise/write-review?content_id=<?php echo $v['content_id'] ?>"
                                                   style="margin-bottom: 15px">学习/回顾</a>
                                            <?php } ?>
                                        <?php } else { ?>
                                            <a onclick="_czc.push(['_trackEvent','做题练习-<?php echo $cate_seo_name; ?>-<?php echo $v['catName'] ?>','开始做题','<?php echo $v['name'] ?>',''])"
                                               href="/cn/exercise/write-detail?content_id=<?php echo $v['content_id'] ?>"
                                               style="margin-bottom: 15px">开始做题</a>

                                        <?php } ?>
                                    <?php } ?>


                                </div>
                            </li>
                        <?php } ?>
                    </ul>

                <?php } ?>

            <?php } else { ?>  <!-- 话题 难度-->

                <?php foreach ($list as $key => $value) { ?>
                    <p class="exerciseTitle"><?php echo $key ?></p>


                    <ul class="questionList">
                        <!-- 未做 noDo  已做 isDo -->
                        <?php foreach ($value as $k => $v) { ?>
                            <?php
                            $vid = $v['content_id'];
                            // $sessionid = 'pid'.$vid;
                            // $resultid = Yii::$app->session->get($sessionid);
                            // if(!$resultid){
                            $resultid = RankingAll::find('resultid')->where(['userid' => $userId, 'typeid' => $type, 'pid' => $vid])->andWhere(['not', ['testid' => null]])->orderBy('id desc')->distinct()->asArray()->One();
                            $resultid = $resultid['resultid'];
                            // }

                            // 查询重复名词做题次数 根据题号累加
                            $name  = $v['name'];
                            $vount = 0; // 练习人数
                            $dal   = $model->getlistenexercisedotest($vid);
                            // f_d($dal);
                            $allnumber     = 0; // 所有做题数
                            $allnum        = 0; // 所有题数
                            $alltruenumber = 0; // 所有正确题数
                            // $num = 0;
                            foreach ($dal as $vcc) {
                                $vount = $vount + $vcc['viewCount'];
                                $id    = $vcc['content_id'];
                                // 总数
                                $num    = count(ExerciseListDetail::find()->where(['pid' => $id])->asArray()->All());
                                $allnum = $allnum + $num;
                                // 做题数
                                $number    = count(RankingAll::find()->where(['userid' => $userId, 'typeid' => $type, 'pid' => $id, 'resultid' => $resultid])->andWhere(['not', ['testid' => null]])->asArray()->All());
                                $allnumber = $allnumber + $number;
                                // 正确
                                $truenumber    = count(RankingAll::find()->where(['userid' => $userId, 'result' => 1, 'typeid' => $type, 'pid' => $id])->andWhere(['not', ['testid' => null]])->asArray()->All());
                                $alltruenumber = $alltruenumber + $truenumber;
                            }
                            ?>
                            <li>

                                <img src="https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/icon@2x.png"
                                     class="exerciseIco">
                                <span class="questionStatus <?php echo $allnumber <= 0 ? 'notDone' : ($allnumber == $number ? 'finish' : 'breakOff') ?>"> <?php echo $allnumber <= 0 ? '未做' : ($allnumber == $number ? '已完成' : '中断') ?></span>
                                <p class="questionType"><?php echo $key ?></p>
                                <p class="questionName"><?php echo $typename ?><?php echo $v['name'] ?></p>
                                <p class="questionNum">
                                    <span><?php echo $key ?></span>
                                    <span><?php echo $v['viewCount'] ?>人已做</span>
                                </p>
                                <div class="hoveButton">
                                    <!-- <a href="/cn/exercise/listen-detail?content_id=<?php echo $v['content_id'] ?>"
                                       style="margin-bottom: 15px">继续做题</a>
                                    <a href="/cn/exercise/listen-detail?content_id=<?php echo $v['content_id'] ?>">学习/回顾</a> -->

                                    <?php if ($userId) { ?>
                                        <?php if ($allnumber <= 0) { ?>
                                            <a onclick="_czc.push(['_trackEvent','做题练习-<?php echo $cate_seo_name; ?>-<?php echo $v['catName'] ?>','开始做题','<?php echo $v['name'] ?>',''])"
                                               href="/cn/exercise/<?php if ($type == 1) {
                                                   echo 'listen';
                                               } elseif ($type == 2) {
                                                   echo 'read';
                                               } elseif ($type == 3) {
                                                   echo 'write';
                                               } else {
                                                   echo 'speak';
                                               } ?>-detail?content_id=<?php echo $v['content_id'] ?>"
                                               style="margin-bottom: 15px">开始做题</a>

                                        <?php } elseif ($allnumber == $number) { ?>
                                            <a href="/cn/exercise/<?php if ($type == 1) {
                                                echo 'listen';
                                            } elseif ($type == 2) {
                                                echo 'read';
                                            } elseif ($type == 3) {
                                                echo 'write';
                                            } else {
                                                echo 'speak';
                                            } ?>-detail?content_id=<?php echo $v['content_id'] ?>"
                                               style="margin-bottom: 15px">重新做题</a>
                                            <a href="/cn/exercise/<?php if ($type == 1) {
                                                echo 'listen';
                                            } elseif ($type == 2) {
                                                echo 'read';
                                            } elseif ($type == 3) {
                                                echo 'write';
                                            } else {
                                                echo 'speak';
                                            } ?>-review?content_id=<?php echo $v['content_id'] ?>"
                                               style="margin-bottom: 15px">学习/回顾</a>

                                        <?php } else { ?>

                                            <a href="/cn/exercise/<?php if ($type == 1) {
                                                echo 'listen';
                                            } elseif ($type == 2) {
                                                echo 'read';
                                            } elseif ($type == 3) {
                                                echo 'write';
                                            } else {
                                                echo 'speak';
                                            } ?>-detail?content_id=<?php echo $v['content_id'] ?>"
                                               style="margin-bottom: 15px">继续做题</a>
                                            <a href="/cn/exercise/<?php if ($type == 1) {
                                                echo 'listen';
                                            } elseif ($type == 2) {
                                                echo 'read';
                                            } elseif ($type == 3) {
                                                echo 'write';
                                            } else {
                                                echo 'speak';
                                            } ?>-review?content_id=<?php echo $v['content_id'] ?>"
                                               style="margin-bottom: 15px">学习/回顾</a>
                                        <?php } ?>

                                    <?php } else { ?>
                                        <a onclick="_czc.push(['_trackEvent','做题练习-<?php echo $cate_seo_name; ?>-<?php echo $v['catName'] ?>','开始做题','<?php echo $v['name'] ?>',''])"
                                           href="/cn/exercise/<?php if ($type == 1) {
                                               echo 'listen';
                                           } elseif ($type == 2) {
                                               echo 'read';
                                           } elseif ($type == 3) {
                                               echo 'write';
                                           } else {
                                               echo 'speak';
                                           } ?>-detail?content_id=<?php echo $v['content_id'] ?>"
                                           style="margin-bottom: 15px">开始做题</a>
                                    <?php } ?>

                                </div>
                            </li>
                        <?php } ?>
                    </ul>
                <?php } ?>

            <?php } ?>

        <?php endif ?>


    </div>
</div>

<!--旧版-->
<section id="exerciseIndex" v-cloak　style="display:none ">
    <div class="banner">
        <?php if (!$userId): ?>
            <!-- 未登录-->
            <a href="/login.html?source=10&url=http://<?php echo $_SERVER['SERVER_NAME'] . Yii::$app->request->getUrl() ?>">
                <img src="/cn/images/exerciseNew/1@2x.png" alt=""></a>
        <?php else: ?>
            <!-- 登录-->
            <a href="/mall.html"><img src="/cn/images/exerciseNew/banner@2x.png" alt=""></a>
        <?php endif ?>
    </div>
    <div class="realTimeData">
        <p class="title">申友雅思真题练习</p>
        <div class="realData">
            <div class="realItem shu">
                <p><?php echo $doing_num ?></p>
                <span>正在做题人数</span>
            </div>
            <div class="realItem shu">
                <p><?php echo $today_num ?></p>
                <span>今日做题人数</span>
            </div>
            <div class="realItem shu">
                <p><?php echo $heap_num ?></p>
                <span>累计做题人数</span>
            </div>
            <div class="realItem">
                <p><?php echo $already_num ?></p>
                <span>已助考雅思人数</span>
            </div>
        </div>

        <div class="exerciseContent">
            <!-- 个人学习数据-->
            <div class="personData">
                <div class="personTitle">
                    <img src="/cn/images/exerciseNew/3@2x.png" alt="" style="width: 23px;height: 22px;">
                    <p>个人学习数据</p>
                </div>
                <div class="personInfo">
                    <div class="personAva1"><img src="/cn/images/index/mifeng.png" alt=""></div>
                    <p class="personNick"><?php echo $userInfo ? $userInfo['nickname'] : ""; ?></p>
                </div>
                <div class="realpersonData">
                    <div class="realpersonItem shuPerson">
                        <p><?php echo $today_exercise_num ?></p>
                        <span>今日做题数</span>
                    </div>
                    <div class="realpersonItem shuPerson">
                        <p><?php echo $exercise_num ?></p>
                        <span>累计做题数</span>
                    </div>
                    <div class="realpersonItem ">
                        <p><?php echo $study_days ?>天</p>
                        <span>已累计学习</span>
                    </div>
                </div>
                <div class="personTitle">
                    <img src="/cn/images/exerciseNew/4@2x.png" alt="" style="width: 24px;height: 24px;">
                    <p>烤鸭排行榜</p>
                </div>
                <div class="rankCover">
                    <!-- 循环rankItem  取7个  需求未说轮播-->
                    <?php if ($ielts_rank): ?>
                        <?php foreach ($ielts_rank as $key => $value): ?>
                            <div class="rankItem">
                                <p class="rankNum"><?php echo $key + 1 ?></p>
                                <p class="rankNick"><?php echo $value['userName'] ?></p>
                                <p class="rankRate">
                                    <span><?php echo $value['order'] ?>%</span>
                                    正确率
                                </p>
                            </div>
                        <?php endforeach ?>
                    <?php endif ?>
                </div>
            </div>
            <!-- 练习板块-->
            <div class="exerciseModel">
                <a href="javascript:void(0)" class="oldDataBtn" @click="showPast">查看往期做题记录 》</a>
                <div class="exercisePlate">
                    <div class="plateItem">
                        <p class="plateBg">LISTENING</p>
                        <div class="plateContent">
                            <img src="/cn/images/exerciseNew/8@2x.png" alt="" style="width: 73px;height: 67px;">
                            <div class="plateType">
                                <div class="plateJump">
                                    <p>听力</p>
                                    <a href="/cn/exercise/listen?category=all">去练习 ></a>
                                </div>
                                <div class="plateHref">
                                    <a href="/cn/exercise/listen?category=type">按题型练</a>
                                    <a href="/cn/exercise/listen?category=topic">按话题练</a>
                                    <a href="/cn/exercise/listen?category=level">按难度练</a>
                                    <!-- <a href="/cn/exercise/409.html">听力必备词汇</a>
                                    <a href="/cn/exercise/424.html">听力分题型练习</a> -->
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="plateItem">
                        <p class="plateBg">SPEAKING</p>
                        <div class="plateContent">
                            <img src="/cn/images/exerciseNew/9@2x.png" alt="" style="width: 63px;height: 68px;">
                            <div class="plateType">
                                <div class="plateJump">
                                    <p>口语</p>
                                    <a href="/cn/exercise/speak?category=all">去练习 ></a>
                                </div>
                                <div class="plateHref">
                                    <!-- <a href="">按题型练</a> -->
                                    <!-- <a href="/cn/exercise/speak?category=topic">按话题练</a> -->
                                    <!-- <a href="">按难度练</a> -->
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="plateItem">
                        <p class="plateBg">READING</p>
                        <div class="plateContent">
                            <img src="/cn/images/exerciseNew/10@2x.png" alt="" style="width: 65px;height: 53px;">
                            <div class="plateType">
                                <div class="plateJump">
                                    <p>阅读</p>
                                    <a href="/cn/exercise/read?category=all">去练习 ></a>
                                </div>
                                <div class="plateHref">
                                    <a href="/cn/exercise/read?category=type">按题型练</a>
                                    <a href="/cn/exercise/read?category=topic">按话题练</a>
                                    <a href="/cn/exercise/read?category=level">按难度练</a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="plateItem">
                        <p class="plateBg">WRITING</p>
                        <div class="plateContent">
                            <img src="/cn/images/exerciseNew/11@2x.png" alt="" style="width: 57px;height: 50px;">
                            <div class="plateType">
                                <div class="plateJump">
                                    <p>写作</p>
                                    <a href="/cn/exercise/write?category=all">去练习 ></a>
                                </div>
                                <div class="plateHref">
                                    <a href="/cn/exercise/write?category=type">按题型练</a>
                                    <!-- <a href="">按话题练</a>
                                    <a href="">按难度练</a> -->
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <a href="http://p.qiao.baidu.com/cps/chat?siteId=15132328&amp;userId=3827656&amp;siteToken=99b1fe8baeddcfd1e53e480b5339af8d"
                   class="programBtn">免费获取我的专属备考方案</a>
            </div>
        </div>
    </div>
    <!-- 往期做题 记录弹窗-->
    <div class="pastExercisePop" v-if="isPast" v-cloak>
        <div class="pastExerciseContent">
            <p class="pastExerciseTitle">我的历史做题记录</p>
            <img src="/cn/images/exerciseNew/chacha.png" alt="" class="closePast" @click="isPast = false">
            <div class="pastExerciseList">
                <div class="pastExerciseItem bgColor1">
                    <p class="date bgColor1">日期</p>
                    <p class="listen">听力</p>
                    <p class="speak">口语</p>
                    <p class="read">阅读</p>
                    <p class="write">写作</p>
                    <p class="totole">总分</p>
                </div>
                <div class="pastExerciseItem" v-for="(item,index) in pastData">
                    <p class="date bgColor1">{{item.createtime}}</p>
                    <p class="listen">{{item.listen_score}}</p>
                    <p class="speak">{{item.speak_score}}</p>
                    <p class="read">{{item.read_score}}</p>
                    <p class="write">{{item.write_score}}</p>
                    <p class="totole">{{item.total}}</p>
                </div>
            </div>
            <div class="pageSizeCover">
                <img src="/cn/images/exerciseNew/31.png" alt="" @click="prev(currentPage)">
                <a :class="item == currentPage?'on pageLi':'pageLi'" href="javascript:void(0)" v-for="item in pageStr"
                   @click="getData(item)">{{item}}</a>
                <img src="/cn/images/exerciseNew/30.png" alt="" @click="next(currentPage)">
            </div>
        </div>
    </div>
</section>


<script src="/cn/js/exerciseNew/index.js?v=1.1"></script>
<script>
    $('.firstNav li').mouseover(function () {
        $(this).addClass('on');
    });
    $('.firstNav li:first-child').mouseover(function () {
        $(this).find('img').attr("src", "https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/listeningOn.png")
    });
    $('.firstNav li:nth-child(2)').mouseover(function () {
        $(this).find('img').attr("src", "https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/speakingOn.png")
    });
    $('.firstNav li:nth-child(3)').mouseover(function () {
        $(this).find('img').attr("src", "https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/readingOn.png")
    });
    $('.firstNav li:nth-child(4)').mouseover(function () {
        $(this).find('img').attr("src", "https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/writingOn.png")
    });
    $('.firstNav li').mouseleave(function () {
        console.log('$(this).attr(\'data-type\')', $(this).attr('data-type'));
        console.log('<?php echo $type ?>',<?php echo $type ?>);
        if ($(this).attr('data-type') !=<?php echo $type ?>) {
            $(this).removeClass('on')
        }
    })
    $('.firstNav li:first-child').mouseleave(function () {
        if ($(this).attr('data-type') !=<?php echo $type ?>) {
            $(this).find('img').attr("src", "https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/listening.png")
        }
    });
    $('.firstNav li:nth-child(2)').mouseleave(function () {
        if ($(this).attr('data-type') !=<?php echo $type ?>) {
            $(this).find('img').attr("src", "https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/speaking@2x.png")
        }
    });
    $('.firstNav li:nth-child(3)').mouseleave(function () {
        if ($(this).attr('data-type') !=<?php echo $type ?>) {
            $(this).find('img').attr("src", "https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/reading@2x.png")
        }
    });
    $('.firstNav li:nth-child(4)').mouseleave(function () {
        if ($(this).attr('data-type') !=<?php echo $type ?>) {
            $(this).find('img').attr("src", "https://file.viplgw.cn/ui/thinku-ielts-new/images/newExercise/writing@2x.png")
        }
    });
    $('.secondNav li').mouseover(function () {
        $(this).addClass('on')
    })
    $('.secondNav li').mouseleave(function () {
        if ($(this).attr('data-cate') != '<?php echo $category ?>') {
            $(this).removeClass('on')
        }
    })
    $('.thirdNav li').mouseover(function () {
        $(this).addClass('on')
    })
    $('.thirdNav li').mouseleave(function () {
        if ($(this).attr('data-cateId') != '<?php echo $cate_id ?>') {
            $(this).removeClass('on')
        }
    })
</script>
